/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"E8B2E5E6-C827-4887-B5AC-8E6EC20B8E09",variableType:93}
 */
var fFechaHasta = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"2D398DC3-9743-4420-A1C4-748BAF146181",variableType:93}
 */
var fFechaDesde = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"A87B9272-2663-49C7-8D40-756B426513C7",variableType:4}
 */
var fPagador = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"E1549420-7798-4A1F-97E0-1DC68AEC6E32",variableType:4}
 */
var fConsorcio = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"EC716290-05A3-4DAB-B19E-00ABD9516E5E"}
 */
function modificar(event) {
	databaseManager.setAutoSave(false)
	var $win = application.createWindow('ALTA_INGRESO_EXTRA',JSWindow.MODAL_DIALOG)
	if (fecha_factura.getMonth() == application.getServerTimeStamp().getMonth())
	{
		forms.ingresos_extra_dtl.controller.readOnly = false
	}
	else
	{
		forms.ingresos_extra_dtl.controller.readOnly = true
	}
	forms.ingresos_extra_dtl.controller.show($win)
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E4C14E49-D82F-49DF-A56B-106BDAE08A5B"}
 * @AllowToRunInFind
 */
function buscar(event) {
	controller.find()
	
	consorcio_id = fConsorcio
	pagador_id = fPagador
	
	if (fFechaDesde != null && fFechaHasta != null)
	{
		var fd = new Date(fFechaDesde.getFullYear(), fFechaDesde.getMonth(),fFechaDesde.getDate(),0,0,0,0)
		var fh = new Date(fFechaHasta.getFullYear(), fFechaHasta.getMonth(),fFechaHasta.getDate(),23,59,59,997)
		fecha_factura = '#'+utils.dateFormat(fh,'dd-MM-yyyy')+' ... '+ utils.dateFormat(fd,'dd-MM-yyyy')+'|dd-MM-yyyy'
	}
	if (controller.search() == 0)
	{
		globals.DIALOGS.showWarningDialog('Aviso','No se encontraron resultados','OK')
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"4BA99059-D1B0-4C44-BC66-56FA946FA7DB"}
 */
function nuevo(event) {
	databaseManager.setAutoSave(false)
	var $win = application.createWindow('ALTA_INGRESO_EXTRA',JSWindow.MODAL_DIALOG)
	forms.ingresos_extra_dtl.controller.readOnly = false
	forms.ingresos_extra_dtl.controller.newRecord()
	forms.ingresos_extra_dtl.controller.show($win)
}
